package main

import "fmt"

func main() {
	done := make(chan int, 10)
	fmt.Println("done len make-1", len(done), cap(done))
	for i := 0; i < cap(done); i++ {
		go func(j int) {
			fmt.Println("done len make-2", len(done), cap(done))
			fmt.Println("你好，世界" + fmt.Sprintf("%v", j))
			done <- 1
			fmt.Println("done len make-3", len(done), cap(done))
		}(i)
	}
	fmt.Println("done len make-4", len(done), cap(done))
	//等待N个后台线程完成
	for i := 0; i < cap(done); i++ {
		fmt.Println("done len make-5", len(done), cap(done))
		<-done
	}
}
